3. FRB/US, a simple experiment#

This notebook is based on the the FRB/US model packages located here (https://www.federalreserve.gov/econres/us-models-package.htm). The packages provides an Eviews (https://www.eviews.com/) implementation. The Eviews modelspecification has been transformed to ModelFlow BusinessLogic specification.

In this notebook you can make your own experiments by updating variables. Also You can watch some of the capabilities of ModelFlow

FRB/US comes in two flawors: VAR in which expectaions are generated by backward looking equations, and MCE in which expectation are based on leaded values.

This notebook implement the VAR flavour.

3.1. Import Python libraries#

from modelclass import model  
model.widescreen() # Use the whole screen 

3.2. Load the model and the data#

The model and the data has been prepared in a preprocessor step and has been wrapped into one file.

mfrbus, basedf =  model.modelload('mfrbusvar.pcim',run=0) 
res = mfrbus(basedf,'2020q1','2025q4',silent=True,stats=False)
file read:  C:\modelflow manual\papers\modelbook\content\Federal Reserve Board - US model\mfrbusvar.pcim

3.3. Run alternative#

# Make a new DataFrame with an updated variable # Update variables in the dataframe
altdf=basedf.upd('rffintay_aerr + -0.05')
res2 = mfrbus(altdf)

3.4. Show the results#

mfrbus['XGDPN RFF'].dif.rename().plot(top=0.8,title='Impact');
../../_images/FRBUS simple experiment_10_0.png

3.5. Trace what drives the results#

The call graph upstream or downstream a variable can be displayed. The thickness of the edges reflect the max explanation of the changes in the variable to the next variable. (for the last experiment)

3.5.1. Preceding variables can be traced#

mfrbus.XGDP.tracepre() 
../../_images/FRBUS simple experiment_13_0.svg

3.5.2. Preceding variables can be filtered#

So only significant variables are displayed
in this case variable explaining less than 20 percent are pruned from the dependency tree

mfrbus.XGDP.tracepre(filter=20) 
../../_images/FRBUS simple experiment_15_0.svg

3.5.3. The levels preceding can be specified#

mfrbus.XGDP.tracepre(up=3,filter=20) 
../../_images/FRBUS simple experiment_17_0.svg

3.5.4. Dependent variable can be traced#

The levels are specified by down instead of up:

mfrbus.XGDP.tracedep(down=2) 
../../_images/FRBUS simple experiment_19_0.svg
from modelwidget import visshow
xx = visshow(mfrbus,'XGDPN RFF',show_on = False)
2+2
4